<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\AuthCheckToken;
use app\common\middleware\AllowCrossDomain;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});

Route::get('hello/:name', 'index/hello');


Route::group(function () {
    Route::post('login', 'Login/login');
    Route::get('captcha', 'Login/verify');
    Route::get('loginout', 'Login/logout');
    Route::get('clear', 'Login/clear');

    Route::group('member', function () {
        Route::get('/info', 'system.Member/info');
        Route::post('/add', 'system.Member/add');
        Route::post('/index', 'system.Member/index');
        Route::get('/del', 'system.Member/del');
        Route::post('/edit', 'system.Member/edit');
        Route::get('/findMemberRole', 'system.Member/findMemberRole');
        Route::get('/getShopList', 'system.Member/getShopList');

    })->middleware([AuthCheckToken::class]);

    Route::group('menu', function () {
        Route::get('/router', 'system.Menu/getRouter');
        Route::get('/tree', 'system.Menu/menuTree');
        Route::post('/add', 'system.Menu/add');
        Route::post('/edit', 'system.Menu/edit');
        Route::get('/changeStatus', 'system.Menu/changeStatus');
        Route::post('/changeOrder', 'system.Menu/changeOrder');
        Route::get('/del', 'system.Menu/del');
    })->middleware([AuthCheckToken::class]);

    Route::group('role', function () {
        Route::post('/index', 'system.Role/index');
        Route::post('/add', 'system.Role/add');
        Route::get('/del', 'system.Role/del');
        Route::post('/edit', 'system.Role/edit');
        Route::get('/selectRoleMenuId', 'system.Role/selectRoleMenuId');
        Route::get('/changeStatus', 'system.Menu/changeStatus');
        Route::post('/changeOrder', 'system.Menu/changeOrder');
        Route::get('/selectRole', 'system.Role/selectRole');
    })->middleware([AuthCheckToken::class]);

    Route::group('dept', function () {
        Route::get('/tree', 'system.Dept/deptTree');
        Route::post('/add', 'system.Dept/add');
        Route::post('/edit', 'system.Dept/edit');
        Route::post('/changeOrder', 'system.Dept/changeOrder');
        Route::get('/del', 'system.Dept/del');
    })->middleware([AuthCheckToken::class]);

})->middleware([AllowCrossDomain::class]);

